/**
 * Created by 24950 on 2017/7/19.
 */
var peopleListArr = [[],[]];
var deletePeopleListArr = [[],[]];

$(function() {
	$('.pop input,.pop select').on("focus", function() {
		$(this).parent('.ipt_box').css("border", "1px solid #5B97FB");
	});
	$('.pop input,.pop select').on("blur", function() {
		$(this).parent('.ipt_box').css("border", "1px solid #ddd");
	});
	$(".user_login,.user_psd").on("focus", function() {
		$(this).parent('.ipt_box').css("border", "1px solid #ddd");
	});
	
	// 下拉框多选
	$('[name="select_more"]').click(function(){  
		$(".pop .sel_more").hide(); 
		$(this).find(".sel_more").show(); 
	});
	$(".pop").click(function(e){
		var target = $(e.target);
		if(target.closest('[name="select_more"]').length == 0){
			$(".pop .sel_more").hide();
		}
	});
	
	// 转法人 模糊查询
	/*
	 * var data = [ {name:"某某",id:1}, {name:"姓名",id:2}, {name:"溜溜",id:3},
	 * {name:"发顺",id:3}, {name:"第三方",id:3}, {name:"水电费",id:3}, {name:"是的",id:3},
	 * {name:"天域套",id:4} ];
	 */

	var data = [];
	$.ajax({
		url : "../user/getUserInfo",
		type : "POST",
		data : {
			pageNumber : 1,
			pageSize : 1000000
    
		},		
		success : function(result) {
			if (result.ret.succeed) {
				var data = result.page.list;
				query(data);
				// query(data);
				$("#zfr").keyup(function(event) {
					//getAllPerson(data);
					
					var e = event || window.event || arguments.callee.caller.arguments[0];
					if(e && e.keyCode==8){   // BackSpace 键
						deletePeople();
					}
					var ipt_arr = $(this).val().split(",");
					var key = ipt_arr[$(ipt_arr).length-1];
					searchPeople(key,data);
				})
			} else {
				if (result.ret.retCode == 2003) {
					window.location.href = "login.html";
				} else {
					layer.msg(result.ret.retMsg);
				}
			}
		}
	});
	$("#redirect_desc").focus(function(){
		$("#peopleList").hide().empty();
		var nameStr = "";
		$(deletePeopleListArr[0]).each(function(i){
			nameStr += deletePeopleListArr[1][i]+",";
		});
		$("#zfr").val(nameStr);
	})
});

function selectMorePeople(obj){
	 var str = "";
    if(!$(obj).attr("class")){
        $(obj).addClass("active");
    }else {
        $(obj).removeClass("active");
    }
    $(obj).parent("ul").find(".active").each(function(){
        str +=  $(this).html() + "、";
    });
    $(obj).parent().siblings("input").val(str.substring(0,str.length-1));
}

function searchPeople(key,data){
	var list = '';
	$("#peopleList").show().empty();
	$(data).each(function(i,item){
		if(data[i].user_username.indexOf(key)>-1 || data[i].py.indexOf(key)>-1){
			list += '<li id="'+data[i].user_id+'" onclick="selectPeople(this)"><u>'+data[i].user_username+'</u><i>'+data[i].py+'</i></li>'
		}
	});
	$("#peopleList").append(list);
}
function selectPeople(obj){
	peopleListArr = deletePeopleListArr;
	$("#peopleList").hide();
	var existState = false;
	$(peopleListArr[0]).each(function(i){
		if($(obj).attr("id") == peopleListArr[0][i]){
			existState = true;
			layer.msg("已选择此转发人！");
			return false;
		}
	})
	if(!existState){
		peopleListArr[0].push($(obj).attr("id"));
		peopleListArr[1].push($(obj).find("u").html());
	}
	var idStr = "",nameStr = "";
	$(peopleListArr[0]).each(function(i){
		idStr += peopleListArr[0][i]+",";
		nameStr += peopleListArr[1][i]+",";
	})
	idStr = ","+ idStr;
	$("#zfr_id").val(idStr);
	$("#zfr").val(nameStr).focus();
}

function deletePeople(){
	deletePeopleListArr = [[],[]];
	var iptVal = $("#zfr").val().split(","); 
	$(peopleListArr[1]).each(function(i){
		$(iptVal).each(function(j){
			if(iptVal[j] == peopleListArr[1][i]){
				deletePeopleListArr[0].push(peopleListArr[0][i]);
				deletePeopleListArr[1].push(peopleListArr[1][i]);
			}
		})
	});
	var idStr = "";
	$(deletePeopleListArr[0]).each(function(i){
		idStr += deletePeopleListArr[0][i]+",";	
	});
	idStr = ","+ idStr;
	$("#zfr_id").val(idStr);
}

function getUserStatus(status) {
	if (status == 0) {
		return "试用";
	} else if (status == 1) {
		return "正式";
	} else if (status == 2) {
		return "临时";
	} else if (status == 3) {
		return "试用延期";
	} else if (status == 4) {
		return "解聘";
	} else if (status == 5) {
		return "离职";
	} else if (status == 6) {
		return "退休	";
	} else if (status == 7) {
		return "无效	";
	}
}

/**
 * 获取OA签字类型
 * 
 * @param type
 */
function getOALogType(type) {
	if (type == 0) {
		return "批准";
	} else if (type == 1) {
		return "保存";
	} else if (type == 2) {
		return "提交";
	} else if (type == 3) {
		return "退回";
	} else if (type == 4) {
		return "重新打开";
	} else if (type == 5) {
		return "删除";
	} else if (type == 6) {
		return "激活";
	} else if (type == 7) {
		return "转发";
	} else if (type == 9) {
		return "批注";
	} else if (type == 'e') {
		return "强制归档";
	} else if (type == 't') {
		return "抄送";
	} else if (type == 's') {
		return "督办";
	}
}

/**
 * 获取项目分类code
 * 
 * @param type
 * @returns
 */
function getPcode(type) {
	if (type == "" || type == null) {
		return type;
	} else {
		var t1 = type.substring(0, 1);
		var t2 = type.substring(0, 2);
		if (t1 == 'C') {
			if (t2 == 'C2') {
				return t2;
			} else if (t2 == 'C3') {
				return t2;
			} else if (t2 == 'C4') {
				return t2;
			} else {
				return t1;
			}
		} else if (t1 == 'E') {
			if (t2 == 'E2') {
				return t2;
			} else if (t2 == 'E3') {
				return t2;
			} else if (t2 == 'E4') {
				return t2;
			} else {
				return t1;
			}
		} else if (t1 == 'F') {
			if (t2 == 'F2') {
				return t2;
			} else if (t2 == 'F3') {
				return t2;
			} else if (t2 == 'F4') {
				return t2;
			} else {
				return t1;
			}
		} else if (t1 == 'G') {
			if (t2 == 'G2') {
				return t2;
			} else if (t2 == 'G3') {
				return t2;
			} else if (t2 == 'G4') {
				return t2;
			} else {
				return t1;
			}
		} else {
			return t1;
		}
		/*
		 * if(type.substring(0,1) == 'C' || type.substring(0,1) == 'E' ||
		 * type.substring(0,1) == 'F' || type.substring(0,1) == 'G'){ return
		 * type.substring(0,2); }else{ return type.substring(0,1); }
		 */
	}
}

/**
 * 根据项目状态获取相关描述
 * 
 * @param status
 * @returns {String}
 */
function getProjectStatusDesc(status) {
	var desc = '';
	if (status == 0) {
		desc = '保存立项信息';
	} else if (status == 1) {
		desc = '提交立项信息';
	} else if (status == 2) {
		desc = '立项会评审中  ';
	} else if (status == 3) {
		desc = '立项会评审中';
	} else if (status == 4) {
		desc = '立项会评审中';
	} else if (status == 5) {
		desc = '立项会评审中';
	} else if (status == 6) {
		desc = '立项会评审中';
	} else if (status == 7) {
		desc = '投票完成';
	} else if (status == 8) {
		desc = '会签';
	} else if (status == 9) {
		desc = '质控专员审批完成';
	} else if (status == 10) {
		desc = '质控负责人审批完成';
	} else if (status == 11) {
		desc = '立项完成';
	} else if (status == 12) {
		desc = '团队负责人审批完成';
	} else if (status == 13) {
		desc = '被退回';
	} else {
		desc = '';
	}
	return desc;
}

/**
 * 获取项目类型
 * 
 * @param num
 */
function getProjectType(num) {
	if (num == 1) {
		return "A股份公司首次公开发行股票保荐及主承销项目";
	} else if (num == 2) {
		return "B上市公司再融资保荐及主承销项目";
	} else if (num == 3) {
		return "C债券发行主承销项目";
	} else if (num == 4) {
		return "D新三板推荐业务项目";
	} else if (num == 5) {
		return "E其他财务顾问类项目";
	} else if (num == 6) {
		return "F债券分销类项目";
	} else if (num == 7) {
		return "G其他类型项目";
	} else if (num == 30) {
		return "C2债券发行主承销项目";
	} else if (num == 40) {
		return "C3债券发行主承销项目";
	} else if (num == 50) {
		return "C4债券发行主承销项目";
	} else if (num == 60) {
		return "E2其他财务顾问类项目";
	} else if (num == 70) {
		return "E3其他财务顾问类项目";
	} else if (num == 80) {
		return "E4其他财务顾问类项目";
	} else if (num == 90) {
		return "F2债券分销类项目";
	} else if (num == 100) {
		return "F3债券分销类项目";
	} else if (num == 110) {
		return "F4债券分销类项目";
	} else if (num == 120) {
		return "G2其他类型项目";
	} else if (num == 130) {
		return "G3其他类型项目";
	} else {
		return "G4其他类型项目";
	}
}

/**
 * 获取项目投票状态
 * 
 * @param num
 */
function getVoteStatus(num) {
	if (num == 0) {
		return "待初始投票";
	} else if (num == 1) {
		return "待开启投票";
	} else if (num == 2) {
		return "投票中";
	} else if (num == 3) {
		return "投票逾期";
	} else if (num == 4) {
		return "投票完结";
	} else if (num == 5) {
		return "未到时间";
	}
}

/**
 * 获取会议状态
 * 
 * @param num
 */
function getMeetStatus(num) {
	if (num == 0) {
		return "会议申请中";
	} else if (num == 1) {
		return "已发起会议";
	} else if (num == 2) {
		return "已开会议";
	} else if (num == 3) {
		return "已更新附件";
	}
}


/**
 * 获取督导项目状态
 * 
 * @param num
 */
function getSupervisionStatus(num) {
	if (num == 0) {
		return "待申请";
	} else if (num == 1) {
		return "保存";
	} else if (num == 2) {
		return "提交";
	} else if (num == 3) {
		return "团队负责人审批完成";
	} else if (num == 4) {
		return "督导委员审批完成";
	} else if (num == 9) {
		return "被退回";
	} else if (num == 10) {
		return "完成";
	}
}

/**
 * 获取协议分类合同类型编码
 * 
 * @param prop
 * @param type
 */
function getXyflContractCode(prop, type) {
	if (prop == 'A') {
		if (type == 0) {
			return "HZ";
		} else if (type == 1) {
			return "CG";
		} else if (type == 2) {
			return "FD";
		} else if (type == 3) {
			return "BJ";
		} else if (type == 4) {
			return "CX";
		} else if (type == 5) {
			return "BM";
		} else if (type == 6) {
			return "JC";
		} else if (type == 7) {
			return "JG";
		} else if (type == 8) {
			return "ZX";
		} else if (type == 9) {
			return "QT";
		} else if (type == 10) {
			return "RG";
		}
	} else if (prop == 'B') {
		if (type == 0) {
			return "HZ";
		} else if (type == 1) {
			return "CG";
		} else if (type == 2) {
			return "BJ";
		} else if (type == 3) {
			return "CX";
		} else if (type == 4) {
			return "BM";
		} else if (type == 5) {
			return "JC";
		} else if (type == 6) {
			return "JG";
		} else if (type == 7) {
			return "ZX";
		} else if (type == 8) {
			return "QT";
		} else if (type == 9) {
			return "RG";
		}
	} else if (prop == 'C') {
		if (type == 0) {
			return "HZ";
		} else if (type == 1) {
			return "CX";
		} else if (type == 2) {
			return "RG";
		} else if (type == 3) {
			return "BM";
		} else if (type == 4) {
			return "TG";
		} else if (type == 5) {
			return "JG";
		} else if (type == 6) {
			return "JC";
		} else if (type == 7) {
			return "ZX";
		} else if (type == 8) {
			return "QT";
		}
	} else if (prop == 'D') {
		if (type == 0) {
			return "HZ";
		} else if (type == 1) {
			return "CG";
		} else if (type == 2) {
			return "TJ";
		} else if (type == 3) {
			return "DD";
		} else if (type == 4) {
			return "JG";
		} else if (type == 5) {
			return "JC";
		} else if (type == 6) {
			return "BM";
		} else if (type == 7) {
			return "ZX";
		} else if (type == 8) {
			return "QT";
		}
	} else if (prop == 'E') {
		if (type == 0) {
			return "HZ";
		} else if (type == 1) {
			return "CG";
		} else if (type == 2) {
			return "JC";
		} else if (type == 3) {
			return "ZX";
		} else if (type == 4) {
			return "BM";
		} else if (type == 5) {
			return "QT";
		}
	} else if (prop == 'F') {
		if (type == 0) {
			return "HZ";
		} else if (type == 1) {
			return "FX";
		} else if (type == 2) {
			return "RG";
		} else if (type == 3) {
			return "JC";
		} else if (type == 4) {
			return "ZX";
		} else if (type == 5) {
			return "BM";
		} else if (type == 6) {
			return "QT";
		}
	} else {
		if (type == 0) {
			return "ZL";
		} else if (type == 1) {
			return "HZ";
		} else if (type == 2) {
			return "CG";
		} else if (type == 3) {
			return "JC";
		} else if (type == 4) {
			return "ZX";
		} else if (type == 5) {
			return "BM";
		} else {
			return "QT";
		}
	}
}

/**
 * 获取协议分类合同类型编码
 * 
 * @param prop
 * @param type
 */
function getXyflContractName(prop, type) {
	if (prop == 'A') {
		if (type == 0) {
			return "合作框架协议";
		} else if (type == 1) {
			return "财务顾问协议";
		} else if (type == 2) {
			return "辅导协议";
		} else if (type == 3) {
			return "保荐协议";
		} else if (type == 4) {
			return "承销协议";
		} else if (type == 5) {
			return "保密协议";
		} else if (type == 6) {
			return "解除合同协议";
		} else if (type == 7) {
			return "监管协议";
		} else if (type == 8) {
			return "咨询服务协议";
		} else if (type == 9) {
			return "其他协议";
		} else if (type == 10) {
			return "认购协议";
		}
	} else if (prop == 'B') {
		if (type == 0) {
			return "合作框架协议";
		} else if (type == 1) {
			return "财务顾问协议（含并购重组、重大资产、买壳上市等）";
		} else if (type == 2) {
			return "保荐协议";
		} else if (type == 3) {
			return "承销协议";
		} else if (type == 4) {
			return "保密协议";
		} else if (type == 5) {
			return "解除合同协议";
		} else if (type == 6) {
			return "监管协议";
		} else if (type == 7) {
			return "咨询服务协议";
		} else if (type == 8) {
			return "其他协议";
		} else if (type == 9) {
			return "认购协议";
		}
	} else if (prop == 'C') {
		if (type == 0) {
			return "合作框架协议";
		} else if (type == 1) {
			return "承销（团）协议";
		} else if (type == 2) {
			return "认购协议";
		} else if (type == 3) {
			return "保密协议";
		} else if (type == 4) {
			return "托管协议（含受 托管理协议、债权代理协议、债券持有人会议规则等）";
		} else if (type == 5) {
			return "监管协议";
		} else if (type == 6) {
			return "解除合同协议";
		} else if (type == 7) {
			return "咨询服务协议";
		} else if (type == 8) {
			return "其他协议";
		}
	} else if (prop == 'D') {
		if (type == 0) {
			return "合作框架协议";
		} else if (type == 1) {
			return "财务顾问协议（含挂牌、发行、并购重组等）";
		} else if (type == 2) {
			return "推荐挂牌并持续督导协议";
		} else if (type == 3) {
			return "持续督导协议";
		} else if (type == 4) {
			return "监管协议";
		} else if (type == 5) {
			return "解除合同协议";
		} else if (type == 6) {
			return "保密协议";
		} else if (type == 7) {
			return "咨询服务协议";
		} else if (type == 8) {
			return "其他协议";
		}
	} else if (prop == 'E') {
		if (type == 0) {
			return "合作框架协议";
		} else if (type == 1) {
			return "财务顾问协议";
		} else if (type == 2) {
			return "解除合同协议";
		} else if (type == 3) {
			return "咨询服务协议";
		} else if (type == 4) {
			return "保密协议";
		} else if (type == 5) {
			return "其他协议";
		}
	} else if (prop == 'F') {
		if (type == 0) {
			return "合作框架协议";
		} else if (type == 1) {
			return "分销协议";
		} else if (type == 2) {
			return "认购协议";
		} else if (type == 3) {
			return "解除合同协议";
		} else if (type == 4) {
			return "咨询服务协议";
		} else if (type == 5) {
			return "保密协议";
		} else if (type == 6) {
			return "其他协议";
		}
	} else {
		if (type == 0) {
			return "战略合作协议";
		} else if (type == 1) {
			return "合作框架协议";
		} else if (type == 2) {
			return "财务顾问协议";
		} else if (type == 3) {
			return "解除合同协议";
		} else if (type == 4) {
			return "咨询服务协议";
		} else if (type == 5) {
			return "保密协议";
		} else {
			return "其他协议";
		}
	}
}

/**
 * 获取投票结果
 * 
 * @param num
 * @returns {String}
 */
function getVoteResult(num) {
	if (num == 1) {
		return "通过";
	} else if (num == 2) {
		return "不通过";
	} else {
		return "暂无";
	}
}

/**
 * 流程紧急程度
 * 
 * @param num
 * @returns {String}
 */
function getPriority(num) {
	if (num == 0) {
		return "正常";
	} else if (num == 1) {
		return "紧急";
	}
}

/**
 * 获取协议盖章状态
 * 
 * @param num
 * @returns {String}
 */
function getProtocolDesc(num) {
	if (num == 0) {
		return "尚未申请";
	} else if (num == 1) {
		return "申请中";
	} else if (num == 2) {
		return "OA进行中";
	} else if (num == 3) {
		return "盖章完成";
	} else {
		return "退回";
	}
}

/**
 * 判断是否是纯数字
 * 
 * @param obj
 */
function judgeNum(obj) {
	var content = obj.value;
	var patrn = /^[-\d]+(\.\d+)?$/;
	if (!patrn.exec(content)) {
		$(obj).val('');
		$(obj).focus();
	}
}

/**
 * 发送提醒短信
 */
function sendWarnMsg(ids, content) {
	$.ajax({
		url : "../vote/sendMsg",
		data : {
			ids : ids,
			content : content
		},
		type : "POST",
		success : function(result) {
			if (result.ret.succeed) {
				$(".shade,.pop_tptx").hide();
				layer.msg(result.ret.retMsg);
			} else {
				if (result.ret.retCode == 2003) {
					window.location.href = "login.html";
				} else {
					layer.msg(result.ret.retMsg);
				}
			}
		}
	});
}

/**
 * 发送提醒邮件
 */
function sendWarnMail(ids, content) {
	$.ajax({
		url : "../vote/sendWarnMail",
		data : {
			ids : ids,
			content : content
		},
		type : "POST",
		success : function(result) {
			if (result.ret.succeed) {
				$(".shade,.pop_tptx").hide();
				layer.msg(result.ret.retMsg);
			} else {
				if (result.ret.retCode == 2003) {
					window.location.href = "login.html";
				} else {
					layer.msg(result.ret.retMsg);
				}
			}
		}
	});
}

/**
 * 根据质评id获取流程进度
 */
function showQualityFlowProgress(id) {
	// var project_id = $("#project_name")[0].lang;
	$.ajax({
		url : "../workflowModel/getQualityWorkflowProgress",
		data : {
			quality_id : id,
		},
		type : "POST",
		success : function(data) {
			if (data.ret.succeed) {
				// console.log("data.json:"+data.json);
				document.getElementById("iframe").contentWindow.loadData(
						data.json, data.currentNodes);
				document.getElementById("bigiframe").contentWindow.loadData(
						data.json, data.currentNodes);
			} else {
				// layer.msg(data.ret.retMsg);
				document.getElementById("iframe").contentWindow.clearData();
				document.getElementById("bigiframe").contentWindow.clearData();
			}
		}

	});
}

/**
 * 根据督导报告id获取流程进度
 */
function showReportFlowProgress(id) {
	// var project_id = $("#project_name")[0].lang;
	$.ajax({
		url : "../workflowModel/getReportWorkflowProgress",
		data : {
			report_id : id,
		},
		type : "POST",
		success : function(data) {
			if (data.ret.succeed) {
				// console.log("data.json:"+data.json);
				document.getElementById("iframe").contentWindow.loadData(
						data.json, data.currentNodes);
				document.getElementById("bigiframe").contentWindow.loadData(
						data.json, data.currentNodes);
			} else {
				// layer.msg(data.ret.retMsg);
				document.getElementById("iframe").contentWindow.clearData();
				document.getElementById("bigiframe").contentWindow.clearData();
			}
		}

	});
}

/**
 * 根据公告申请id获取流程进度
 */
function showAnnouncementFlowProgress(id) {
	// var project_id = $("#project_name")[0].lang;
	$.ajax({
		url : "../workflowModel/getAnnouncementWorkflowProgress",
		data : {
			id : id,
		},
		type : "POST",
		success : function(data) {
			if (data.ret.succeed) {
				// console.log("data.json:"+data.json);
				document.getElementById("iframe").contentWindow.loadData(
						data.json, data.currentNodes);
				document.getElementById("bigiframe").contentWindow.loadData(
						data.json, data.currentNodes);
			} else {
				// layer.msg(data.ret.retMsg);
				document.getElementById("iframe").contentWindow.clearData();
				document.getElementById("bigiframe").contentWindow.clearData();
			}
		}

	});
}
/**
 * 根据重大异常申报申请id获取流程进度
 */
function showMajorFlowProgress(id) {

	$.ajax({
		url : "../workflowModel/getMajorWorkflowProgress",
		data : {
			id : id,
		},
		type : "POST",
		success : function(data) {
			if (data.ret.succeed) {
				// console.log("data.json:"+data.json);
				document.getElementById("iframe").contentWindow.loadData(
						data.json, data.currentNodes);
				document.getElementById("bigiframe").contentWindow.loadData(
						data.json, data.currentNodes);
			} else {
				// layer.msg(data.ret.retMsg);
				document.getElementById("iframe").contentWindow.clearData();
				document.getElementById("bigiframe").contentWindow.clearData();
			}
		}

	});
}

/**
 * 根据公告申请id获取流程进度
 */
function showDraftFlowProgress(id) {
	// var project_id = $("#project_name")[0].lang;
	$.ajax({
		url : "../workflowModel/getDraftWorkflowProgress",
		data : {
			id : id,
		},
		type : "POST",
		success : function(data) {
			if (data.ret.succeed) {
				// console.log("data.json:"+data.json);
				document.getElementById("iframe").contentWindow.loadData(
						data.json, data.currentNodes);
				document.getElementById("bigiframe").contentWindow.loadData(
						data.json, data.currentNodes);
			} else {
				// layer.msg(data.ret.retMsg);
				document.getElementById("iframe").contentWindow.clearData();
				document.getElementById("bigiframe").contentWindow.clearData();
			}
		}

	});
}

/**
 * 根据发行id获取流程进度
 */
function showReleaseFlowProgress(id) {
    // var project_id = $("#project_name")[0].lang;
    $.ajax({
        url : "../workflowModel/getReleaseWorkflowProgress",
        data : {
            id : id,
        },
        type : "POST",
        success : function(data) {
            if (data.ret.succeed) {
                // console.log("data.json:"+data.json);
                document.getElementById("iframe").contentWindow.loadData(
                    data.json, data.currentNodes);
                document.getElementById("bigiframe").contentWindow.loadData(
                    data.json, data.currentNodes);
            } else {
                // layer.msg(data.ret.retMsg);
                document.getElementById("iframe").contentWindow.clearData();
                document.getElementById("bigiframe").contentWindow.clearData();
            }
        }

    });
}

/**
 * 获取会议详情
 * 
 * @param vote_basic_id
 */
function getMeetInfo(vote_basic_id) {
	$.ajax({
		url : "../vote/getMeetInfo",
		type : "POST",
		data : {
			vote_basic_id : vote_basic_id
		},
		success : function(result) {
			if (result.ret.succeed) {
				var userList = result.userList;
				var meet = result.meet;
				if (meet == null || meet == "") {
					return;
				} else {
					$("#project_meet_info_detail_li").show();
				}
				var nameStr = "";
				for (var int = 0; int < userList.length; int++) {
					nameStr += userList[int].user_username + ",";
				}
				if (nameStr.length > 0) {
					nameStr = nameStr.substring(0, nameStr.length - 1);
				}

				$("#detail_start_meet_project_name").val(meet.project_name);
				$("#detail_start_meet_project_type").text(
						getProjectType(meet.project_type));
				$(
						"#detail_start_meet_syle option[value="
								+ meet.meet_type + "]").attr("selected", true);
				$("#detail_start_meet_place").val(meet.meet_place);
				$("#detail_start_meet_time").val(meet.meet_time);
				$("#detail_meet_name").val(nameStr);
				$("#detail_start_meet_user_input").val(meet.user_username);

			} else {
				if (result.ret.retCode == 2003) {
					window.location.href = "login.html";
				} else {
					layer.msg(result.ret.retMsg);
				}
			}
		}
	});
}

/**
 * 展示流程进度图
 */
function showFlowProgress(project_id, type) {
	// var project_id = $("#project_name")[0].lang;
	$.ajax({
		url : "../workflowModel/getWorkflowProgress",
		data : {
			project_id : project_id,
			workflow_type : type
		},
		type : "POST",
		success : function(data) {
			if (data.ret.succeed) {
				// console.log("data.json:"+data.json);
				document.getElementById("iframe").contentWindow.loadData(
						data.json, data.currentNodes);
				document.getElementById("bigiframe").contentWindow.loadData(
						data.json, data.currentNodes);
			} else {
				// layer.msg(data.ret.retMsg);
				document.getElementById("iframe").contentWindow.clearData();
				document.getElementById("bigiframe").contentWindow.clearData();
			}
		}

	});
}

/**
 * 更新附件通知
 * 
 * @param meet_id
 */
function sendMeetEmailAndMsgForFileUpdate(meet_id) {
	$.ajax({
		url : "../core/sendMeetEmailAndMsgForFileUpdate",
		data : {
			meet_id : meet_id
		},
		type : "POST",
		success : function(result) {
			if (result.ret.succeed) {
				layer.msg(result.ret.retMsg);
			} else {
				if (result.ret.retCode == 2003) {
					window.location.href = "login.html";
				} else {
					layer.msg(result.ret.retMsg);
				}
			}
		}
	});
}

/**
 * 更新附件
 * 
 * @param meet_id
 */
function updateVoteFile(meet_id) {
	$.ajax({
		url : "../core/updateVoteFile",
		data : {
			meet_id : meet_id
		},
		type : "POST",
		success : function(result) {
			if (result.ret.succeed) {
				layer.msg(result.ret.retMsg);
				$(".shade,.pop_attachment").hide();
				sendMeetEmailAndMsgForFileUpdate(meet_id);
			} else {
				if (result.ret.retCode == 2003) {
					window.location.href = "login.html";
				} else {
					layer.msg(result.ret.retMsg);
				}
			}
		}
	});
}


function getAllPerson(securInfo) {
	$("#zfr").autocomplete(securInfo,
					{
						minChars : 0,// 自动完成激活之前填入的最小字符
						max : 12,// 列表条目数
						width : 674,// 提示的宽度
						scrollHeight : 300,// 提示的高度
						matchContains : true,// 是否只要包含文本框里的就可以
						cacheLength: 1,    //缓存的长度.即缓存多少条记录.设成1为不缓存.Default: 10
						multiple : true, // 是否允许输入多个值
						autoFill : false,// 自动填充
						delay: 20,
						scroll: true,
						cacheLength :1,
						formatItem : function(data, i, max) {// 格式化列表中的条目  row:条目对象,i:当前条目数,max:总条目数 val='"+data.ID+"'
							return '<div id="' + data.user_id + '"><u>' + data.user_username
									+ '</u><i style="opacity:0;">' + data.py
									+ '</i></div>';
						},
						formatMatch : function(data, i, max) {// 配合formatItem使用，作用在于，由于使用了formatItem，所以条目中的内容有所改变，而我们要匹配的是原始的数据，所以用formatMatch做一个调整，使之匹配原始数据
							return data.user_username + data.user_id + data.py;
						},
						formatResult : function(data) {// 定义最终返回的数据，比如我们还是要返回原始数据，而不是formatItem过的数据
							return data.user_username;
						}
				}).result(function(event, data, formatted) {
					
			});
}

// 拼音首字母缩写  
function query(data) {
	$(data).each(function(i, item) {	
		var str = item.user_username.trim();
		if(!makePy(str).toString()) return;
		data[i].py = makePy(str).toString()+makePy(str).toString().toLowerCase();
	});

}

function stringLengthLimit(str,len,strinit){
	if(str && str.length > len){
		str = str.substr(0,len)+"...";
	}else if(str == undefined || str  == null || str  == "") {
		str = strinit ? strinit : "--"
	}
	return str;
}
